package com.lsh.airticket.dto;

import java.util.HashMap;
import java.util.Map;


public class Result {
    private Integer status = 1;  //1成功状态码  2失败状态码
    private Map<String, Object> data = new HashMap<>();
    private String msg;

    public Result() {
    }
    public static Result result() {
        return new Result();
    }

    public Result(Integer status, Map<String, Object> data, String msg) {
        this.status = status;
        this.data = data;
        this.msg = msg;
    }

    /**
     * 添加返回的数据
     * @return
     */
    public Result addData(String key, Object value) {
        data.put(key, value);
        return this;
    }

    public Integer getStatus() {
        return status;
    }

    public Result setStatus(Integer status) {
        this.status = status;
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }



    public String getMsg() {
        return msg;
    }

    public Result setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    @Override
    public String toString() {
        return "Result{" +
                "status=" + status +
                ", data=" + data +
                ", msg='" + msg + '\'' +
                '}';
    }
}
